#ifndef _BSP_DOTMATRIX_H_
#define _BSP_DOTMATRIX_H_
 
#include "gd32f4xx.h"

#define RCU_MAX7219_CLK         RCU_GPIOB 
#define PORT_MAX7219_CLK        GPIOB 
#define GPIO_MAX7219_CLK        GPIO_PIN_15

#define RCU_MAX7219_DIN         RCU_GPIOB
#define PORT_MAX7219_DIN        GPIOB   
#define GPIO_MAX7219_DIN        GPIO_PIN_10
        
#define RCU_MAX7219_CS          RCU_GPIOB
#define PORT_MAX7219_CS         GPIOB     
#define GPIO_MAX7219_CS         GPIO_PIN_13

#define MAX7219_CLK(X) gpio_bit_write(PORT_MAX7219_CLK, GPIO_MAX7219_CLK, X?SET:RESET)
#define MAX7219_DIN(X) gpio_bit_write(PORT_MAX7219_DIN, GPIO_MAX7219_DIN, X?SET:RESET)
#define MAX7219_CS(X)  gpio_bit_write(PORT_MAX7219_CS,  GPIO_MAX7219_CS,  X?SET:RESET)


void Write_Max7219(uint8_t address,uint8_t dat);
void Write_Max7219_2(unsigned char address,unsigned char dat);
void Write_Max7219_AllOff(void);
void MAX7219_Init(void);
void Max7219_display(uint8_t* show1, uint8_t* show2, uint8_t* show3, uint8_t* show4);
#endif


